\section{Antenna Directivity Optimization}
\label{sec:proposed}

%------------------------------------------------------------------------------

\subsection{Antenna Directivity}
\label{ssec:statemement}
As described by Eqn.~(\ref{eq:friis_complex}), the attenuation
introduced by the wireless medium, strongly depends on the directivity
function. Based on this, the orientation of the antennas in a WiNoC
represents an interesting parameter to be explored.

The energy consumed by a wireless communication between a given
transmitter and receiver pair, depends on their reciprocal location
and orientations. Specifically, the energy consumed for wirelessly
transmitting a bit of information from transmitter $i$ to receiver $j$
is:
\begin{equation}
  E_{ij}^{tx} = \frac{P_{t_{ij}}}{\eta R_b},
  \label{eq:ebit}
\end{equation}
where $\eta$ is the transmitter efficiency. Considering
Eqns.~(\ref{eq:pt}) and~(\ref{eq:friis_complex}), the
Eqn.~(\ref{eq:ebit}) can be written as:
\begin{equation}
  E^{tx}_{ij}=\frac{P_r/ D_t(\Phi_{ij})D_r(\Phi_{ji})\bigg(\frac{\lambda}{2\pi R_{ij}}
  \bigg)^2}{\eta R_b}.
  \label{eq:total_energy1}
\end{equation}
Let $\psi_i$ and $\psi_j$ be a rotation of antenna $i$ and antenna $j$
as respect to the die plane, respectively. Thus,
Eqn.~(\ref{eq:total_energy1}) normalized by the constant terms can be
written as:
\begin{equation}
  \overline{E^{tx}_{ij}}=\frac{ R^2_{ij} }
  {D_t(\Phi_{ij}-\psi_i)D_r(\Phi_{ji}-\psi_j)}.
  \label{eq:total_energy2}
\end{equation}
Thus, for minimizing the communication energy from $i$ to $j$, it
needs to determine a rotation $\psi_i$ and a rotation $\psi_j$ such
that Eqn.~(\ref{eq:total_energy2}) is minimized.

\begin{figure}
  \centering
  \begin{tabular}{cc}
    \multicolumn{2}{c}{\includegraphics[width=0.4\textwidth]{pictures/orientations.eps}} \\
    (a) & (b)
  \end{tabular}
  \caption{Reciprocal antennas orientation and directivity
    functions. The directivity between C0 and C3 improves from
    configuration (a) to configuration (b).}
  \label{fig:orientations}
\end{figure}
For the sake of example, let us consider
Fig.~\ref{fig:orientations}(a) in which four antennas and their
reciprocal orientations in the die plane are shown. The energy
consumption of the communication between tiles C0 and C3 can be
minimized by maximizing the directivity of their respective
antennas. This is obtained by rotating the antennas in tiles C0 and C3
by the angles $\overline{\psi_0}$ and $\overline{\psi_3}$,
respectively, as shown in Fig.~\ref{fig:orientations}(b).

\begin{figure}
  \centering
  \begin{tabular}{cc}
    \multicolumn{2}{c}{\includegraphics[width=0.4\textwidth]{pictures/orientations_worse.eps}} \\
    (a) & (b)
  \end{tabular}
  \caption{Reciprocal antennas orientation and directivity
    functions. Configuration (a) improves communication energy between
    tiles C0 and C2 whereas configuration (b) improves communication
    energy between tiles C0 and C3.}
  \label{fig:orientations_worse}
\end{figure}
It should be pointed out that, selecting a certain antenna orientation
for improving the energy efficiency of a given transmitter/receiver
pair, might negatively affects the energy figures of other
transmitter/receiver pairs. For instance, the directivity of the antennas
in tiles C0 and C2 before the rotation is maximized [see
  Fig.~\ref{fig:orientations_worse}(a)] and thus, their communication
energy is minimized. However, after the rotation of the antennas in tiles
C0 and C3 [see Fig.~\ref{fig:orientations_worse}(b)], although the
communication energy between C0 and C3 improves, that
between C0 and C2 worsens.


%% Let us consider a generic WiNoC architecture with $N$
%% wireless interfaces (WIs).  The communication energy $E_{ij}$,
%% required for a specific source/destination pair (denoted with
%% subscripts $i$ and $j$, respectively) depends on the reciprocal
%% location and orientations of the antenna of transmitter and receiver,
%% respectively. Thus, considering Eqns.~(\ref{eq:pt})
%% and~(\ref{eq:friis_complex}), the energy spent per bit by the
%% trasmitter can be written as:
%% \begin{equation}
%%   E^{tx}_{ij}=\frac{P_{t_{ij}}}{\eta R_b}=
%%   \frac{P_r/G_{a_{ij}}}{\eta R_b}
%%   =  \frac{P_r/ D_t(\Phi_{ij})D_r(\Phi_{ji})\bigg(\frac{\lambda}{2\pi R_{ij}}
%%   \bigg)^2}{\eta R_b}, 
%%   \label{eq:total_energy1}
%% \end{equation}
%% Antenna orientation respect to the silicon die plane can be specified
%% by angle $\psi$. Considering antennas orientation, 
%% and normalizzing respect to constant values, 
%% Eqn.~(\ref{eq:total_energy1}) can be expressed as:
%% \begin{equation}
%%   \overline{E^{tx}_{ij}}=\frac{ D_t(\Phi_{ij}-\psi_i)D_r(\Phi_{ji}-\psi_j)}
%%   {R^2_{ij}}.
%%   \label{eq:total_energy2}
%% \end{equation}
%% In particular, the minimum energy can be found considering a rotation
%% $\overline{\Psi_{k}}$ which maximizes the directivity.

%% \begin{figure}
%%   \centering
%%   \includegraphics[width=0.4\textwidth]{pictures/orientations.eps}
%%   \caption{Reciprocal antennas orientation. A generic WiNoC with 4 WIs
%%     distributed in a mesh fashion. The green line represents the
%%     antennas directivity function. On the right, the case in which
%%     antennas orientation maximizes the directivity form communication
%%     between when radio hubs C0 and C3.}
%%   \label{fig:orientations}
%% \end{figure}
%% Fig.~\ref{fig:orientations} shows, for instance, a generic WiNoC
%% architecture with 4~WIs and their respective antennas. Considering,
%% the communication between C0 and C3, antenna directivity could be
%% maximized by rotating antenna C0 and C3 by an angle
%% $\overline{\psi_0}$ and $\overline{\psi_3}$, respectively. Based on
%% this, the following equation is derived:
%% \begin{equation}
%%   \overline{E^{tx}_{{ij}_{MIN}}}=\frac{D_t(\Phi_{ij}-\overline{\Psi_i})_{MAX}
%%   D_r(\Phi_{ji}-\overline{\Psi_j})_{MAX}}{{R^2_{ij}}}.
%%   \label{eq:emin}
%% \end{equation}
%% Please notice that, selecting a certain antenna orientation for
%% improving the energy efficiency of a given transmitter/receiver
%% pair, might negatively affect the energy figures of other
%% transmitter/receiver pairs. For instance, considering the
%% communication between C0 and C2, before the rotation, the directivity
%% is maximized (see Fig.~\ref{fig:orientations_worse} left) and thus,
%% the energy per bit is minimized. However, after the rotation
%% (Fig.~\ref{fig:orientations_worse} right), although it improves the
%% energy efficiency for communication between C0 and C3, it negatively
%% affects the communication energy between C0 and C2.
%% \begin{figure}
%%   \centering
%%   \includegraphics[width=0.4\textwidth]{pictures/orientations_worse.eps}
%%   \caption{Reciprocal antennas orientation: rotating the antenna in C0, results
%%   in performance degradation in terms of energy efficiency.}
%%   \label{fig:orientations_worse}
%% \end{figure}

%------------------------------------------------------------------------------

\subsection{Formulation of the Problem}
\label{ssec:asic}
Based on the above considerations, this subsection formulates the
problem of minimizing the wireless communication energy by means of
antennas orientation optimization. Specifically, three scenarios,
namely, \emph{application specific}, \emph{general purpose}, and
\emph{worst case} scenarios will be analyzed. 

%% The following two scenarios are
%% considered. In the first one, communication traffic information are
%% available at design time. We refer to this scenario as
%% \emph{application specific} scenario. In the second one, no
%% information about the communication traffic is available. We refer to
%% this scenario as the \emph{general purpose} scenario.

\subsubsection{Application Specific Scenario}
In the \emph{application specific scenario} it is assumed that
communication traffic information are available at design time. Let
$V_{ij}$ be the traffic volume (in bits) from radio hub $i$ to radio
hub $j$. Let $E_{ij}(\Psi)$ be the energy consumption for transmitting
one bit from radio hub $i$ to radio hub $j$ when the antennas are
oriented based the orientation vector $\Psi$. The $i$-th component of
$\Psi$ represents the orientation of the antenna of radio hub
$i$. $E_{ij}(\Psi)$ is computed by Eqn.~(\ref{eq:total_energy2}). The
total normalized wireless communication energy can be computed as:
\begin{equation}
    E_{tot}^{(as)}(\Psi) = \sum_{i=0}^N \sum_{j=0}^N V_{ij} \times E_{ij}(\Psi).
  \label{eq:total_energy_as}
\end{equation}
Thus, the problem of minimizing the wireless communication energy, by
means of antennas orientation optimization, for the application
specific scenario can be formulated as finding the antennas orientation
vector $\Psi$ which minimizes $E_{tot}^{(as)}(\Psi)$.

\subsubsection{General Purpose Scenario}
In the \emph{general purpose scenario} it is assumed that
communication traffic information are not available at design
time. Based on this, the same traffic volume for each communicating
pair is assumed. The total wireless communication energy per bit can
be computed as:
\begin{equation}
    E_{tot}^{(gp)}(\Psi) = \sum_{i=0}^N \sum_{j=0}^N E_{ij}(\Psi).
  \label{eq:total_energy_gp}
\end{equation}
Thus, the problem of minimizing the wireless communication energy, by
means of antennas orientation optimization, for the general purpose
scenario can be formulated as finding the antennas orientation vector
$\Psi$ which minimizes $E_{tot}^{(gp)}(\Psi)$.

\subsubsection{Worst Case Scenario}
Please notice that, in the above two scenarios (application specific
and general purpose), it is assumed that the transceiver implements a
transmitting power calibration technique (\eg,
\cite{mineo_date14,mineo_date15}) which allows the transmitting radio
hub to use the minimum transmitting power to reach the destination
guaranteeing a certain bit error rate.

In WiNoCs in which the power amplifier (PA) in the transceivers does
not implement any transmitting power modulation mechanism, the PA is
configured to use the maximum transmitting power irrespective of the
recipient of the transmission. We refer to this case as \emph{worst
  case} scenario.  In this case, the total wireless energy consumption
per bit is determined by the maximum $E_{ij}(\Psi)$:
\begin{equation}
    E_{tot}^{(wc)}(\Psi) = \max_{i,j=1,\ldots,N} E_{ij}(\Psi).
  \label{eq:total_energy_wc}
\end{equation}
Thus, the problem of minimizing the wireless communication energy, by
means of antennas orientation optimization, for the worst case
scenario can be formulated as finding the antennas orientation vector
$\Psi$ which minimizes $E_{tot}^{(wc)}(\Psi)$.

%------------------------------------------------------------------------------

\subsection{General Design Flow}
\label{ssec:pmap_det}
The Friis equation used in the problem formulation is not suitable for
computing the actual attenuation of the wireless medium. In fact, it
models only first order effects which are however enough for early
design space exploration. Thus, the use of accurate field solver
simulators or direct measurements on real prototypes are needed for
implement the overall optimization flow. The basic steps which form
the design flow can be summarized as follows.
\begin{enumerate}
  \item Compute the radiation pattern of the antenna by means of a
    field solver simulator or by test-chip measurements. The radiation
    pattern represents the term $D$ in Eqn.~(\ref{eq:total_energy1}).
  
  \item Explore the antennas orientations design space for determing
    the optimal antennas orientations which minimize the total
    communication energy (\cf, subsection~\ref{ssec:asic}).

  \item Configure the antennas with the orientations found in the
    previous step and compute the actual attenuation by means of a
    field solver simulators for determing the transmitting power for
    each antennas pair. Let $P_{t_{ij}}$ be the transmitting power for
    communication from antenna $i$ to antenna $j$.

  \item For the general purpose and application specific scenarios,
    use the $P_{t_{ij}}$ computed in the previous step for configuring
    the variable gain amplifier
    controller~\cite{mineo_date14,mineo_date15}. For the worst case
    scenario, set the transmitting power of every transmitter to $\max
    P_{t_{ij}}$.
\end{enumerate}
In the next section, such design flow is applied for designing energy
efficient WiNoC configurations for the different scenarios, under
different traffic patterns and different parameters.


%% Given the non-linear, high dimensionality, multi-modal, and
%% non-smooth nature of $E_{ij}(\Psi)$, we...

%% In particular, the elements of the E matrix are described by 
%% mean of the Eqn.~\ref{eq:emin} while N is the number of 
%% radio-hubs inside WiNoC.
%% Starting from the Matrix V and the other known terms, the 
%% our problem is to find out the vector of orientation: 
%% %--------------------------------
%% \begin{equation}
%% \Psi =
%%  \begin{pmatrix}
%%   \psi_1 \\ \psi_2 \\ \vdots \\ \psi_N 
%%  \end{pmatrix}
%%  \end{equation}
%% %--------------------------------
%% which specify the antenna orientation for each radio-hub
%% minimizing the overall energy consumption the overall energy.
%% In order to find $\Psi$ we apply the Algorithm~\ref{alg:sa1}.
%% %--------------------------------
%% \begin{algorithm}
%%   \caption{Found the optimal orientations vector $\Psi$}
%%   \label{alg:sa1}
%%   \begin{algorithmic}[1]
%%       \Require $V$, $rhub\_map$, $NO\_ITER$
%%       \Statex

%%       \State $\Psi_{Best}[~] \gets 0$
%%       \State $k\gets 0$

%%       \State $i\gets NO\_ITER$

%%       \While{$i>0$}
%%         \State $\Psi \gets Randomize(\Psi)$
%%         \State $E \gets GetEnergy(\Psi, V, rhub\_map)$
          
%%           \If{$Accepted(E)$}
%%             \State$\Psi_{Best}[k] \gets \Psi$
%%             \State $k\gets k+1$
%%           \EndIf

%%       \State $i \gets i-1$
%%       \EndWhile

%%       \State $ return~\Psi=SelectBestPsi(\Psi_{Best}[~])$

%%   \end{algorithmic} \end{algorithm} 

%------------------------------------------------------------------------------ 

%% \subsection{Worst Case Energy Reduction Method} 
%% \label{ssec:worst_case_red}
%% The algorithm described in the Sec.~\ref{ssec:asic} is useful  when
%% the network traffic is well characterized, which it is typical  in
%% application specific (ASIC) systems. In many cases, unfortunately,
%% designers don't know traffics accurately. For this reason, an
%% alternative algorithm which tries to minimize energy consumption  in
%% the case of random traffics is proposed. The algorithm has the same inputs
%% of the previous method without the V matrix, returning as output the orientations
%% vector which doesn't minimize the overall energy consumption but results
%% in worst case energy reduction. 

%% \begin{algorithm}
%%   \caption{Found the optimal orientations vector $\Psi$ without V matrix}
%%   \label{alg:sa2}
%%   \begin{algorithmic}[1]

%%       \Require $rhub\_map$, $NO\_ITER$
%%       \Statex

%%       \State $\Psi_{Best}[~] \gets 0$
%%       \State $k\gets 0$
%%       \State $i\gets \#ITER$

%%       \While{$i>0$}
%%         \State $\Psi \gets Randomize(\Psi)$
%%         \State $E \gets SearchMaxEnergy(\Psi, rhub\_map)$
          
%%           \If{$Accepted(E)$}
%%             \State$\Psi_{Best}[k] \gets \Psi$
%%             \State $k\gets k+1$
%%           \EndIf

%%       \State $i \gets i-1$
%%       \EndWhile

%%       \State $ return~\Psi=SelectBestPsi(\Psi_{Best}[~])$

%%   \end{algorithmic} \end{algorithm} 

%------------------------------------------------------------------------------

%% \subsection{Proposed Design Flow}
%% \label{ssec:proposed_design}
%% Once the best antennas configuration has been obtained by using
%% previous algorithms, a configuration process has to be done for each
%% transceiver. As described in the Eqn.~\ref{eq:pt} in the
%% Sec.~\ref{sec:ssreq}, determining the minimum transmitting power for
%% each transmitter involves, firstly, in a characterization phase. In
%% particular,  for each $<source, destination>$ pair, the quality of the
%% wireless channel  has to be determinate more accurately by using field
%% solver simulator or a test chip prototype. In fact, it should be
%% pointed out that Eqn.~\ref{eq:friis_complex} used in
%% algorithm~\ref{alg:sa1} and~\ref{alg:sa2}, represents only a first
%% order model, accurate enough for free space communications, but is not
%% accurate enough to characterize on chip attenuation. Fortunately, the
%% effect of directivity described in the same equation still valid and
%% has been proved in~\cite{mineo_date14,tap_07}.  The using of proposed
%% algorithm is justified because using  filed-solver for such
%% optimizations is not adequate since it should requires several time-
%% consuming simulations. Nevertheless, the methodology remain 
%% general by using results from simulation and substituting them 
%% when in algorithms~\ref{alg:sa1},~\ref{alg:sa2} results is obtained
%% following rows x and y respectively.

%% After the characterization phase, the level of transmitting power can be
%% fixed regardless the destination or can be modulated by using a
%% variable gain amplifier controller as in~\cite{mineo_date14,
%% mineo_date15}. Since in the former case each transceiver can be set
%% for working with only one level of transmitting power, the
%% methodology described by algorithm~\ref{alg:sa1} cannot be applied.
%% This is due to the fact that reducing the overall energy consumption
%% requires that, each transmitter can fit a certain
%% level of transmitting power for each destination. This can be done by
%% using such techniques described in ~\cite{mineo_date14, mineo_date15}.
%% Vice-versa, by using methodology described by algorithm~\ref{alg:sa2},
%% when the transceiver has to be configured to fit all the signal
%% strength constrain  for each destination, designers should set the
%% transceiver power considering the worst case attenuation. In fact, 
%% by using~\ref{alg:sa2} results in a reduction of the worst case
%% level of energy...

%% This section can be concluded by considering design flows depicted 
%% in Fig.~\ref{fig:design_flow}. The flow in the left represent
%% the design steps suggest for the algorithm in~\ref{alg:sa1} while
%% in the right design steps for the Alg.~\ref{alg:sa1} are represented.
%% The former consists, in the application mapping, distributing hub
%% following procedure in~\cite{deb_tc13}. Finally the proposed
%% tool~\cite{} produces the best orientation vector to be used
%% as input for a filed solver simulator. Finally the attenuations
%% obtained with simulation, are used to obtain transmitting power
%% values usefull in conjunction of the techniques developed
%% in~\cite{mineo_date14, mineo_date15}. The flow reported
%% in the right is slightly different respect the previous approach.
%% In fact, the application mapping is not mandatory, since
%% the traffic hasn't to be characterized. The filed solver characterization
%% could be necessary once, only to determining the worst case attenuation.

%% \begin{figure}
%%   \centering
%%   \includegraphics[width=0.4\textwidth]{pictures/design_flow.eps}
%%   \caption{Design Flow}
%%   \label{fig:design_flow}
%% \end{figure}
